package com.guoranhao.web.util;

import org.apache.commons.lang.StringUtils;

/**
 * Description:密码工具类
 * Copyright (c) Department of Research and Development/Beijing
 * All Rights Reserved.
 *
 * @version 1.0  2018/11/27 11:32  by  李海兵(lihb@cloud-young.com) 创建
 */
public class PasswordUtil {

    /**
     * Description: 密码正则匹配8~18位(字母+数字)
     *
     * @param password
     * @return
     * @Version1.0 2018/11/18 21:46 by 李海兵（lihb@cloud-young.com）创建
     */
    public static boolean checkPasswordFormat(String password) {

        if (StringUtils.isEmpty(password)) {
            return false;
        }

        String regex = "(?!^[0-9]*$)(?!^[a-zA-Z]*$).{8,18}$";

        return password.matches(regex);

    }
}
